/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package idea.model.qnrlibrary;


import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;


/**
 *
 * @author rejun001
 */
@Entity
@Table( name = "de_ag" )
@XmlRootElement
@NamedQueries( 
{
    @NamedQuery( name = "DeAg.findAll" , query = "SELECT d FROM DeAg d" ) ,
    @NamedQuery( name = "DeAg.findByDeAgId" , query = "SELECT d FROM DeAg d WHERE d.deAgId = :deAgId" ) ,
    @NamedQuery( name = "DeAg.findByAgId" , query = "SELECT d FROM DeAg d WHERE d.agId = :agId" ) ,
    @NamedQuery( name = "DeAg.findByDateCreated" , query = "SELECT d FROM DeAg d WHERE d.dateCreated = :dateCreated" ) ,
    @NamedQuery( name = "DeAg.findByCreatedBy" , query = "SELECT d FROM DeAg d WHERE d.createdBy = :createdBy" ) ,
    @NamedQuery( name = "DeAg.findByDateModified" , query = "SELECT d FROM DeAg d WHERE d.dateModified = :dateModified" ) ,
    @NamedQuery( name = "DeAg.findByModifiedBy" , query = "SELECT d FROM DeAg d WHERE d.modifiedBy = :modifiedBy" )
} )
public class DeAg implements Serializable
{
    private static final long serialVersionUID = 1L;
    @Id
    @Basic( optional = false )
    @Column( name = "de_ag_id" )
    private String deAgId;
    @Basic( optional = false )
    @Column( name = "ag_id" )
    private String agId;
    @Basic( optional = false )
    @Column( name = "date_created" )
    @Temporal( TemporalType.TIMESTAMP )
    private Date dateCreated;
    @Basic( optional = false )
    @Column( name = "created_by" )
    private String createdBy;
    @Column( name = "date_modified" )
    @Temporal( TemporalType.TIMESTAMP )
    private Date dateModified;
    @Column( name = "modified_by" )
    private String modifiedBy;
    @JoinColumn( name = "de_id" , referencedColumnName = "de_id" )
    @ManyToOne( optional = false )
    private DataElements deId;


    public DeAg()
    {
    }


    public DeAg( String deAgId )
    {
        this.deAgId = deAgId;
    }


    public DeAg( String deAgId , String agId , Date dateCreated , String createdBy )
    {
        this.deAgId = deAgId;
        this.agId = agId;
        this.dateCreated = dateCreated;
        this.createdBy = createdBy;
    }


    public String getDeAgId()
    {
        return deAgId;
    }


    public void setDeAgId( String deAgId )
    {
        this.deAgId = deAgId;
    }


    public String getAgId()
    {
        return agId;
    }


    public void setAgId( String agId )
    {
        this.agId = agId;
    }


    public Date getDateCreated()
    {
        return dateCreated;
    }


    public void setDateCreated( Date dateCreated )
    {
        this.dateCreated = dateCreated;
    }


    public String getCreatedBy()
    {
        return createdBy;
    }


    public void setCreatedBy( String createdBy )
    {
        this.createdBy = createdBy;
    }


    public Date getDateModified()
    {
        return dateModified;
    }


    public void setDateModified( Date dateModified )
    {
        this.dateModified = dateModified;
    }


    public String getModifiedBy()
    {
        return modifiedBy;
    }


    public void setModifiedBy( String modifiedBy )
    {
        this.modifiedBy = modifiedBy;
    }


    public DataElements getDeId()
    {
        return deId;
    }


    public void setDeId( DataElements deId )
    {
        this.deId = deId;
    }


    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += ( deAgId != null ? deAgId.hashCode() : 0 );
        return hash;
    }


    @Override
    public boolean equals( Object object )
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if ( !( object instanceof DeAg ) )
        {
            return false;
        }
        DeAg other = (DeAg) object;
        if ( ( this.deAgId == null && other.deAgId != null ) || ( this.deAgId != null && !this.deAgId.equals( other.deAgId ) ) )
        {
            return false;
        }
        return true;
    }


    @Override
    public String toString()
    {
        return "idea.model.qnrlibrary.DeAg[ deAgId=" + deAgId + " ]";
    }
    
}
